home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5540 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  38 lines

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: embedded strtok() calls on different strings?
  5. Date: 08 Feb 1996 23:56:05 GMT
  6. Organization: Los Alamos National Laboratory
  7. Message-ID: <TANMOY.96Feb8165605@qcd.lanl.gov>
  8. References: <DMGrn7.1Bx0@CompStar.bnr.ca>
  9. NNTP-Posting-Host: qcd.lanl.gov
  10. Mime-Version: 1.0
  11. Content-Type: text
  12. In-reply-to: tzinck@bnr.ca's message of Thu, 8 Feb 1996 15:42:43 GMT
  13.  
  14. In article <DMGrn7.1Bx0@CompStar.bnr.ca> tzinck@bnr.ca writes:
  15. <snip>
  16.    char *string1="This is string one";
  17.    char *string2="This is string two";
  18.  
  19.    void *vp1;
  20.    void *vp2;
  21.  
  22.    vp1 = strtok(string1," ");
  23.  
  24. This line tries to modify a string literal: this invokes undefined
  25. behaviour. Anything could happen, including the program crashing right
  26. away.  You observe a different behaviour: but that is precisely what
  27. `undefined behaviour' means.
  28.  
  29. Cheers
  30. Tanmoy
  31. --
  32. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  33. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  34. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  35. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  36. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  37. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  38.